Repository navigation
test: Make Progress and TitleBar findable in UI tests - #3383
Merged
huacnlee merged 2 commits intoOct 7, 2026
Merged
Conversation
An application's UI tests could not find a Progress bar or the TitleBar's window controls with `TestWindowExt::find`, so they asserted neighbouring text instead or were ignored. Both controls already have stable element IDs, and Progress already sets its progress indicator role and label, but neither called `.test_support()`. Base Progress now keeps its root as an `ObservedElement`, as Base Button does, so Progress and ProgressCircle register with the harness. TitleBar registers `title-bar`, `window-controls` and the caption buttons. Without the `test-support` feature `ObservedElement<E>` is `E`, so normal builds are unchanged. The harness docs list both controls. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PRpJSFk3zTwdgAJHehdZFm
Contributor
Author
huacnlee
enabled auto-merge (squash)
October 7, 2026 05:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
An app's UI tests could not find a
Progressbar or theTitleBarwithTestWindowExt::find. They asserted neighbouring text instead, or the tests were#[ignore]d. Neither control registered its element for the test harness, although both already have stable IDs.Progressalso already sets its accessibility role and label.On
main:Progressholds a plaingpui::Stateful<Div>built withdiv().id(id)(crates/base/src/progress.rs:13,:24). It setsRole::ProgressIndicator, the label and the numeric value, but nothing registers it. ComponentProgress(crates/component/src/progress/progress.rs:120) andProgressCircle(crates/component/src/progress/progress_circle.rs:160) build on it, so neither could be found.TitleBargivestitle-bar,window-controlsand the caption buttons (minimize,maximize/restore,close) element IDs, but does not call.test_support()on them (crates/component/src/title_bar.rs:209,:255,:269,:278,:330onmain).This PR adds the existing
.test_support()registration to these elements, as BaseButtonand other controls already do:crates/base/src/progress.rs:13,24: the root becomescrate::ObservedElement<gpui::Stateful<Div>>, built withdiv().id(id).test_support(). This is the same pattern ascrates/base/src/button.rs:22,41. Without thetest-supportfeature,ObservedElement<E>isE, so normal builds keep the exact type they had before.crates/component/src/title_bar.rs:.test_support()on the caption buttons (:211), on all threewindow-controlsreturns (:257,:271,:281) and ontitle-bar(:354). Ontitle-bar, the call comes after the twoon_double_clickcalls, becauseInteractiveElementExtis implemented only forStateful<E>(crates/base/src/event.rs:60). A short comment there says why.This is a change to
gpui-base, but only to register an element that already exists. It follows how BaseButton,Select,Accordionand others are registered. Nothing else changes: no roles, labels or locale keys are added. TheTitleBarelements still have no accessibility role or name.The table of observable controls in
website/docs/test.mdandwebsite/zh-CN/docs/test.mdgets rows forProgress / ProgressCircleandTitleBar.Where caption buttons appear: on macOS and the web,
WindowControlsrenders an emptywindow-controlsand no buttons. On Linux it draws them only under client-side decorations. GPUI's test window uses server-side decorations (thePlatformWindow::window_decorationsdefault), so in tests the buttons are found only on Windows.This change was written with AI assistance (Claude Code).
How to Test
Two new tests in
crates/kit/tests/components.rs:progress_and_progress_circle_are_observablerenders aProgressand a loadingProgressCircle. It checks thatfind(id)givesRole::ProgressIndicator, the accessibility label, and a visible element.title_bar_and_window_controls_are_observablerenders aTitleBar. It checks thattitle-baris found and visible and thatwindow-controlsis found. On Windows it also checks thatminimize,maximizeandcloseare visible insidewindow-controls. On other platforms it checks thatcloseis absent, because the title bar does not draw caption buttons there.Both tests failed before the fix (
missing ElementId Name("download")andmissing ElementId Name("title-bar"), with no registered paths) and pass after it.Commands run on macOS (aarch64):
I ran clippy with
-A clippy::nonminimal_boolbecause my local clippy (Rust 1.95) reports twononminimal_boolerrors atcrates/base/src/calendar.rs:132. This PR does not touch that file. There are no other clippy findings.I did not run the Windows branch of the TitleBar test (the caption-button assertions). It compiles only on Windows, so CI is the first run of it.
Checklist
PassedNot applicable: the change only registers existing elements for the test harness. It does not change layout or rendering.cargo runfor story tests related to the changes.Tested macOS, Windows and Linux platforms performance (if the change is platform-specific)Not applicable: no platform-specific code changes. The test's caption-button assertions run only on Windows.🤖 Generated with Claude Code
https://claude.ai/code/session_01PRpJSFk3zTwdgAJHehdZFm